As new computer processors are designed, new computer architectural designs are created. The new computer architecture designs improve the processing performance of the new computer processors. However, the existing set of computer programs often can not directly execute on new computer architectures.
To run computer object code written for an older computer architecture on a newer computer processor, many computer systems use software that will “emulate” the older computer processor architecture. Specifically, software running on the newer computer processors simulates the actions of the older computer processor by interpreting each instruction. Software emulators work well for executing many legacy applications. However, software emulation wastes processor power due to the emulation software overhead.
Another method of running computer object code written for an older computer architecture on a new computer processor is to perform binary translation. A binary translator translates blocks of code written for an older source architecture into equivalent blocks of code in the newer target processor architecture. The translation can be done “on the fly” (while “executing” the older source architecture code). Translation could also be done before execution. By translating the old source architecture code into code for the newer processor architecture, the overhead of the emulation code is eliminated. Thus, binary translation often provides better performance than emulation.
When executing older code, both software emulation systems and binary translators must precisely duplicate the environment of the older processor architecture. Software emulators duplicate the behavior of the older processor architecture by providing an interpreter that interprets each microprocessor instruction as the original processor would have. Binary translators provide a duplicate environment by inserting extra instructions as necessary to ensure that various parameter limits of the older processor are not being exceeded. Since the extra instructions are not directly related to the goal of the original program, these extra instructions are “overhead” code that reduce performance. It would be desirable to implement binary translators in a manner that minimizes the amount of overhead code that needs to be added to duplicate the environment of the older processor architecture.